package com.ksyun.camp.modle.vo;

import lombok.Builder;
import lombok.Data;

@Data
public class Result<T> {
    private int code;
    private String msg;
    private String requestId;
    private T data;

    private Result(){}

    public static <T> Result<T> build(int code, String msg, String requestId, T data) {
        Result<T> result = new Result<>();
        result.code = code;
        result.msg = msg;
        result.requestId = requestId;
        result.data = data;
        return result;
    }

    public static <T> Result<T> build(T data,AuthResponse authResponse, String requestId) {
        return build(authResponse.getCode(), authResponse.getMessage(), requestId, data);
    }

}
